package com.ndp.fb.mongo.api;

import com.alibaba.fastjson.JSONObject;
import com.mongodb.DBObject;
import com.mongodb.ReflectionDBObject;

import java.util.Iterator;
import java.util.List;

/**
 * Created by jacky.cheng on 2015/9/28.
 */
public interface BaseMongoService {
    //存 ReflectionDBObject的子类
    void save(ReflectionDBObject o);


    void saveAll(List<ReflectionDBObject> os);

    //直接存json
    void save(DBObject o);

    void save(JSONObject o);

    void save(String json);

    void saveAllJson(List<JSONObject> os);

    Iterator<DBObject> find(DBObject q);

    /**
     *  update
     * @param q condition
     * @param fs fields
     */
    Boolean updates(DBObject q, DBObject fs);
}
